<?php

include_once '../common_mbs.inc.php';
include_once '../smarty.inc.php';

//判断访问权限
$admin_index_module_obj = new osgh_admin_index_module_cls();
$is_warrant = $admin_index_module_obj->is_have_warrant($_ADMIN_ID,'news_list');
if(!$is_warrant) tcmc_cls::ShowMsg("没有权限访问！", "../index_body.html");


$news_obj = new news_cls();
$news_title = isset($_REQUEST['news_title']) ? trim($_REQUEST['news_title']) : '';
$where_str = "news_title like '%{$news_title}%'";
$count = $news_obj->get_news_list(true, $where_str);
$page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
$p = new show_page_cls;
$page_size = 30;
$p -> pvar="page";
$p -> setvar(array("news_title"=>$news_title));
$p -> set($page_size,$count,$page);
$page_str = $p -> output(true);
$limit = $p -> limit();
$news_type_obj = new news_type_cls();
$news_type_list = $news_type_obj->get_news_type_list();
$news_type_tmp = array();
foreach($news_type_list as $type_arr)
{
	$news_type_tmp[$type_arr['news_type_id']] = $type_arr['news_type_name'];
}

$typeList = $news_obj->get_news_list(false, $where_str, 'news_addtime desc', $limit);

for($i=0;$i<count($typeList);$i++)
{
	$typeList[$i]['type_name']=$news_type_tmp[$typeList[$i]['news_type']];
}
$smarty -> assign('news_title' , $news_title);
$smarty -> assign('typelist', $typeList);
$smarty -> assign('page_str' , $page_str);
$smarty -> display('news/news_list.tpl');

?>
